
namespace Patterns4Net.Core.AttributesPatterns
{
    using System.Diagnostics.Contracts;
    using Mono.Cecil;
    using Patterns4Net.Attributes.DesignPatterns;
    using Patterns4Net.Core.Patterns;
    using Patterns4Net.Attributes;

    [Strategy]
    [ContractClass(typeof(ICreatePatternFromAttributesContract))]
    public interface ICreatePatternFromAttribute
    {
        IPattern Crate(CustomAttribute attribute, IMemberDefinition targetType);
    }

    [ContractClassFor(typeof(ICreatePatternFromAttribute))]
    public abstract class ICreatePatternFromAttributesContract : ICreatePatternFromAttribute
    {
        public IPattern Crate(CustomAttribute attribute, IMemberDefinition targetType)
        {
            Contract.Requires(attribute != null);
            Contract.Requires(targetType != null);
            Contract.Ensures(Contract.Result<IPattern>() != null);
            return null;
        }
    }
}
